home *** CD-ROM | disk | FTP | other *** search
- /*
- * AMIGA Libs & Functions for Scott-Free
- *
- * ===================================================================
- *
- * Version History AMIGA:
- * Ver , Date, Author, Comment
- * -------------------------------------------------------------------
- * 1.0 , 28/07/96, Andreas Aumayr, First public release
- * ___________________________________________________________________
- */
-
-
- #include <intuition/intuition.h>
-
- struct IntuitionBase *IntBase;
- struct Screen *WBscreen;
- struct Window *win;
- struct DrawInfo *WBdrawinfo;
-
-
- BOOL open_libs(void)
- {
- IntBase = (struct IntuitionBase *) OpenLibrary("intuition.library",37);
- if (IntBase == NULL) {
- printf("Problems opening Intuition-Lib!\n");
- return(FALSE);
- }
- return(TRUE);
- }
-
- void close_libs(void)
- {
- FreeScreenDrawInfo(WBscreen,WBdrawinfo);
- UnlockPubScreen(NULL,WBscreen);
- if (IntBase != NULL) CloseLibrary(IntBase);
- }
-
- void close_all(void)
- {
- close_libs();
- Close(act_hdl);
- Close(env_hdl);
- }
-
- struct FileHandle *Open_CON(char *type, int left_off, int top_off, int width, int height, char *title, char *flags)
- {
- sprintf(str_buf,"%s:%d/%d/%d/%d/%s/%s",type,left_off,top_off,width,height,title,flags);
- CON_handle = (struct FileHandle *) Open(str_buf,MODE_NEWFILE);
- if (!CON_handle) {
- printf("Failed to open console window '%s'!\n",title);
- close_libs();
- exit(99);
- }
- else return(CON_handle);
- }
-
- void AMIGA_init(void)
- {
- WORD s_height,s_width,w_height_env,w_height_act,w_width,w_left,w_top;
-
- if (open_libs() == FALSE) exit(255);
-
- WBscreen = (struct Screen *) LockPubScreen(NULL);
- WBdrawinfo = (struct DrawInfo *) GetScreenDrawInfo(WBscreen);
- s_height = (WORD) WBscreen->Height;
- s_width = (WORD) WBscreen->Width;
-
- win = WBscreen->FirstWindow;
- w_width = (WORD) (Width * (UWORD) win->IFont->tf_XSize + 2 * 4);
- w_height_env = (WORD) (TopHeight * (UWORD) win->IFont->tf_YSize + (BYTE) WBscreen->BarHeight + 4);
- w_height_act = (WORD) (BottomHeight * (UWORD) win->IFont->tf_YSize + (BYTE) WBscreen->BarHeight + 4);
- w_left = (WORD) (s_width - w_width) / 2;
- w_top = (WORD) (s_height - w_height_env - w_height_act) / 2;
-
- if ((w_width > s_width) || ((w_height_env+w_height_act) > s_height)) {
- printf("Windows are to big for screen!\nTry the -t parameter.\n");
- close_libs();
- exit(20);
- }
-
- env_hdl = Open_CON("RAW",w_left,w_top,w_width,w_height_env,"Environment","NOSIZE");
- clrsys();
- background(BLUE);
- textcolor(WHITE,BLUE);
- cursor(FALSE);
- act_hdl = Open_CON("CON",w_left,w_top+w_height_env,w_width,w_height_act,"SCOTT-Free AMIGA","NOSIZE");
- clrsys();
- background(GREY);
- textcolor(BLACK,GREY);
- cursor(FALSE);
- }
-
-